package com.jin.webvideo.base.linkedfile;

import java.io.Serial;
import java.io.Serializable;
import java.net.URI;
import java.util.HashMap;


public class LinkedProperties extends HashMap<String, String> implements Serializable {
    @Serial
    private static final long serialVersionUID = -7575374799960621800L;

    public LinkedProperties() {
    }

    public boolean getBoolean(String key, boolean defaultVal) {
        Boolean b = getBoolean(key);
        return null == b ? defaultVal : b;
    }
    public Boolean getBoolean(String key) {
        if (!containsKey(key)) {
            return null;
        }
        return Boolean.getBoolean(get(key));
    }

    public int getInt(String key, int defaultVal) {
        Integer b = getInt(key);
        return null == b ? defaultVal : b;
    }
    public Integer getInt(String key) {
        if (!containsKey(key)) {
            return null;
        }
        return Integer.valueOf(get(key));
    }

    public double getDouble(String key, double defaultVal) {
        Double b = getDouble(key);
        return null == b ? defaultVal : b;
    }
    public Double getDouble(String key) {
        if (!containsKey(key)) {
            return null;
        }
        return Double.valueOf(get(key));
    }

    public URI getURI(String key) {
        if (!containsKey(key)) {
            return null;
        }
        return URI.create(get(key));
    }

    public String getDouble(String key, String defaultVal) {
        String b = getString(key);
        return null == b ? defaultVal : b;
    }
    public String getString(String key) {
        return get(key);
    }

}
